home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 2000 October: Mac OS SDK / Dev.CD Oct 00 SDK1.toast / Development Kits / Cross Platform / QuickTime 4.1.2 Windows SDK / CIncludes / QD3D.h < prev    next >
Encoding:
C/C++ Source or Header  |  2000-04-12  |  41.6 KB  |  1,219 lines  |  [TEXT/R*ch]

  1. /*
  2.      File:        QD3D.h
  3.  
  4.      Contains:    Base types for Quickdraw 3D                            
  5.  
  6.      Version:    Technology:    Quickdraw 3D 1.6
  7.                  Release:    QuickTime 4.1
  8.  
  9.      Copyright:    (c) 1995-1999 by Apple Computer, Inc., all rights reserved.
  10.  
  11.      Bugs?:        For bug reports, consult the following page on
  12.                  the World Wide Web:
  13.  
  14.                      http://developer.apple.com/bugreporter/
  15.  
  16. */
  17. #ifndef __QD3D__
  18. #define __QD3D__
  19.  
  20. #ifndef __CONDITIONALMACROS__
  21.     #include <ConditionalMacros.h>
  22. #endif
  23.  
  24.  
  25. #if TARGET_OS_MAC
  26. #ifndef __MACTYPES__
  27.     #include <MacTypes.h>
  28. #endif
  29.  
  30. #endif  /* TARGET_OS_MAC */
  31.  
  32. #include <stdio.h>
  33.  
  34.  
  35. #if PRAGMA_ONCE
  36. #pragma once
  37. #endif
  38.  
  39. #ifdef __cplusplus
  40. extern "C" {
  41. #endif
  42.  
  43. #if PRAGMA_IMPORT
  44. #pragma import on
  45. #endif
  46.  
  47. #if PRAGMA_STRUCT_ALIGN
  48.     #pragma options align=power
  49. #elif PRAGMA_STRUCT_PACKPUSH
  50.     #pragma pack(push, 2)
  51. #elif PRAGMA_STRUCT_PACK
  52.     #pragma pack(2)
  53. #endif
  54.  
  55. #if PRAGMA_ENUM_ALWAYSINT
  56.     #pragma enumsalwaysint on
  57. #elif PRAGMA_ENUM_OPTIONS
  58.     #pragma option enum=int
  59. #elif PRAGMA_ENUM_PACK
  60.     #if __option(pack_enums)
  61.         #define PRAGMA_ENUM_PACK__QD3D__
  62.     #endif
  63.     #pragma options(!pack_enums)
  64. #endif
  65.  
  66. #if TARGET_OS_MAC
  67. #define OS_MACINTOSH 1
  68. #define OS_WIN32 0
  69. #define OS_UNIX 0
  70. #define OS_NEXT 0
  71. #define WINDOW_SYSTEM_MACINTOSH 1
  72. #define WINDOW_SYSTEM_WIN32 0
  73. #define WINDOW_SYSTEM_X11 0
  74. #define WINDOW_SYSTEM_NEXT 0
  75. #endif  /* TARGET_OS_MAC */
  76.  
  77. #if TARGET_OS_WIN32
  78. #define OS_MACINTOSH 0
  79. #define OS_WIN32 1
  80. #define OS_UNIX 0
  81. #define OS_NEXT 0
  82. #define WINDOW_SYSTEM_MACINTOSH 0
  83. #define WINDOW_SYSTEM_WIN32 1
  84. #define WINDOW_SYSTEM_X11 0
  85. #define WINDOW_SYSTEM_NEXT 0
  86. #endif  /* TARGET_OS_WIN32 */
  87.  
  88. #if TARGET_OS_UNIX
  89. #define OS_MACINTOSH 0
  90. #define OS_WIN32 0
  91. #define WINDOW_SYSTEM_MACINTOSH 0
  92. #define WINDOW_SYSTEM_WIN32 0
  93. #if NeXT
  94. #define OS_UNIX 0
  95. #define OS_NEXT 1
  96. #define WINDOW_SYSTEM_X11 0
  97. #define WINDOW_SYSTEM_NEXT 1
  98. #else
  99. #define OS_UNIX 1
  100. #define OS_NEXT 0
  101. #define WINDOW_SYSTEM_X11 1
  102. #define WINDOW_SYSTEM_NEXT 0
  103. #endif  /* NeXT */
  104.  
  105. #endif  /* TARGET_OS_UNIX */
  106.  
  107.  
  108. /******************************************************************************
  109.  **                                                                             **
  110.  **                                Export Control                                 **
  111.  **                                                                             **
  112.  *****************************************************************************/
  113. #if TARGET_OS_WIN32
  114.     #if defined(WIN32_EXPORTING)    /* define when building DLL */
  115.         #define QD3D_EXPORT __declspec( dllexport )     
  116.         #define QD3D_CALL    
  117.         #define QD3D_CALLBACK    
  118.     #else
  119.         #define QD3D_EXPORT __declspec( dllimport )    
  120.         #define QD3D_CALL    __cdecl
  121.         #define QD3D_CALLBACK    __cdecl    
  122.     #endif /* WIN32_EXPORTING */
  123. #else
  124.     #define QD3D_EXPORT
  125.     #define QD3D_CALL    
  126.     #define QD3D_CALLBACK    
  127. #endif  /*  TARGET_OS_WIN32  */
  128.  
  129.  
  130. /******************************************************************************
  131.  **                                                                             **
  132.  **                                NULL definition                                 **
  133.  **                                                                             **
  134.  *****************************************************************************/
  135.  
  136. #ifndef NULL
  137.     #error /*    NULL is undefined?    */
  138. #endif /* NULL */
  139.  
  140. /******************************************************************************
  141.  **                                                                             **
  142.  **                                    Objects                                     **
  143.  **                                                                             **
  144.  *****************************************************************************/
  145. /*
  146.  * Everything in QuickDraw 3D is an OBJECT: a bunch of data with a type,
  147.  * deletion, duplication, and i/o methods.
  148.  */
  149. typedef long                             TQ3ObjectType;
  150. typedef struct OpaqueTQ3Object*         TQ3Object;
  151. /* */
  152. /*
  153.  * There are four subclasses of OBJECT:
  154.  *    an ELEMENT, which is data that is placed in a SET
  155.  *    a SHAREDOBJECT, which is reference-counted data that is shared
  156.  *    VIEWs, which maintain state information for an image
  157.  *    a PICK, which used to query a VIEW
  158.  */
  159. typedef TQ3Object                         TQ3ElementObject;
  160. typedef TQ3Object                         TQ3SharedObject;
  161. typedef TQ3Object                         TQ3ViewObject;
  162. typedef TQ3Object                         TQ3PickObject;
  163. /*
  164.  * There are several types of SharedObjects:
  165.  *    RENDERERs, which paint to a drawContext
  166.  *    DRAWCONTEXTs, which are an interface to a device 
  167.  *    SETs, which maintains "mathematical sets" of ELEMENTs
  168.  *    FILEs, which maintain state information for a metafile
  169.  *    SHAPEs, which affect the state of the View
  170.  *    SHAPEPARTs, which contain geometry-specific data about a picking hit
  171.  *    CONTROLLERSTATEs, which hold state of the output channels for a CONTROLLER
  172.  *    TRACKERs, which represent a position and orientation in the user interface
  173.  *  STRINGs, which are abstractions of text string data.
  174.  *    STORAGE, which is an abstraction for stream-based data storage (files, memory)
  175.  *    TEXTUREs, for sharing bitmap information for TEXTURESHADERS
  176.  *    VIEWHINTs, which specifies viewing preferences in FILEs
  177.  */
  178. typedef TQ3SharedObject                 TQ3RendererObject;
  179. typedef TQ3SharedObject                 TQ3DrawContextObject;
  180. typedef TQ3SharedObject                 TQ3SetObject;
  181. typedef TQ3SharedObject                 TQ3FileObject;
  182. typedef TQ3SharedObject                 TQ3ShapeObject;
  183. typedef TQ3SharedObject                 TQ3ShapePartObject;
  184. typedef TQ3SharedObject                 TQ3ControllerStateObject;
  185. typedef TQ3SharedObject                 TQ3TrackerObject;
  186. typedef TQ3SharedObject                 TQ3StringObject;
  187. typedef TQ3SharedObject                 TQ3StorageObject;
  188. typedef TQ3SharedObject                 TQ3TextureObject;
  189. typedef TQ3SharedObject                 TQ3ViewHintsObject;
  190. /*
  191.  * There is one types of SET:
  192.  *    ATTRIBUTESETs, which contain ATTRIBUTEs which are inherited 
  193.  */
  194. typedef TQ3SetObject                     TQ3AttributeSet;
  195. /*
  196.  * There are many types of SHAPEs:
  197.  *    LIGHTs, which affect how the RENDERER draws 3-D cues
  198.  *    CAMERAs, which affects the location and orientation of the RENDERER in space
  199.  *    GROUPs, which may contain any number of SHARED OBJECTS
  200.  *    GEOMETRYs, which are representations of three-dimensional data
  201.  *    SHADERs, which affect how colors are drawn on a geometry
  202.  *    STYLEs, which affect how the RENDERER paints to the DRAWCONTEXT
  203.  *    TRANSFORMs, which affect the coordinate system in the VIEW
  204.  *    REFERENCEs, which are references to objects in FILEs
  205.  *  UNKNOWN, which hold unknown objects read from a metafile.
  206.  */
  207. typedef TQ3ShapeObject                     TQ3GroupObject;
  208. typedef TQ3ShapeObject                     TQ3GeometryObject;
  209. typedef TQ3ShapeObject                     TQ3ShaderObject;
  210. typedef TQ3ShapeObject                     TQ3StyleObject;
  211. typedef TQ3ShapeObject                     TQ3TransformObject;
  212. typedef TQ3ShapeObject                     TQ3LightObject;
  213. typedef TQ3ShapeObject                     TQ3CameraObject;
  214. typedef TQ3ShapeObject                     TQ3UnknownObject;
  215. typedef TQ3ShapeObject                     TQ3ReferenceObject;
  216. typedef TQ3ShapeObject                     TQ3StateOperatorObject;
  217. /*
  218.  * For now, there is only one type of SHAPEPARTs:
  219.  *    MESHPARTs, which describe some part of a mesh
  220.  */
  221. typedef TQ3ShapePartObject                 TQ3MeshPartObject;
  222. /*
  223.  * There are three types of MESHPARTs:
  224.  *    MESHFACEPARTs, which describe a face of a mesh
  225.  *    MESHEDGEPARTs, which describe a edge of a mesh
  226.  *    MESHVERTEXPARTs, which describe a vertex of a mesh
  227.  */
  228. typedef TQ3MeshPartObject                 TQ3MeshFacePartObject;
  229. typedef TQ3MeshPartObject                 TQ3MeshEdgePartObject;
  230. typedef TQ3MeshPartObject                 TQ3MeshVertexPartObject;
  231. /*
  232.  * A DISPLAY Group can be drawn to a view
  233.  */
  234. typedef TQ3GroupObject                     TQ3DisplayGroupObject;
  235. /*
  236.  * There are many types of SHADERs:
  237.  *    SURFACESHADERs, which affect how the surface of a geometry is painted
  238.  *    ILLUMINATIONSHADERs, which affect how lights affect the color of a surface
  239.  */
  240. typedef TQ3ShaderObject                 TQ3SurfaceShaderObject;
  241. typedef TQ3ShaderObject                 TQ3IlluminationShaderObject;
  242. /*
  243.  * A handle to an object in a group
  244.  */
  245. typedef struct OpaqueTQ3GroupPosition*     TQ3GroupPosition;
  246. /* 
  247.  * TQ3ObjectClassNameString is used for the class name of an object
  248.  */
  249. enum {
  250.     kQ3StringMaximumLength        = 1024
  251. };
  252.  
  253.  
  254.     typedef char TQ3ObjectClassNameString[kQ3StringMaximumLength];
  255.     
  256.     
  257. /******************************************************************************
  258.  **                                                                             **
  259.  **                            Client/Server Things                             **
  260.  **                                                                             **
  261.  *****************************************************************************/
  262. typedef void *                            TQ3ControllerRef;
  263. /******************************************************************************
  264.  **                                                                             **
  265.  **                            Flags and Switches                                 **
  266.  **                                                                             **
  267.  *****************************************************************************/
  268.  
  269. enum TQ3Boolean {
  270.     kQ3False                    = 0,
  271.     kQ3True                        = 1
  272. };
  273. typedef enum TQ3Boolean TQ3Boolean;
  274.  
  275.  
  276. enum TQ3Switch {
  277.     kQ3Off                        = 0,
  278.     kQ3On                        = 1
  279. };
  280. typedef enum TQ3Switch TQ3Switch;
  281.  
  282.  
  283. enum TQ3Status {
  284.     kQ3Failure                    = 0,
  285.     kQ3Success                    = 1
  286. };
  287. typedef enum TQ3Status TQ3Status;
  288.  
  289.  
  290. enum TQ3Axis {
  291.     kQ3AxisX                    = 0,
  292.     kQ3AxisY                    = 1,
  293.     kQ3AxisZ                    = 2
  294. };
  295. typedef enum TQ3Axis TQ3Axis;
  296.  
  297.  
  298. enum TQ3PixelType {
  299.     kQ3PixelTypeRGB32            = 0,                            /* Alpha:8 (ignored), R:8, G:8, B:8    */
  300.     kQ3PixelTypeARGB32            = 1,                            /* Alpha:8, R:8, G:8, B:8             */
  301.     kQ3PixelTypeRGB16            = 2,                            /* Alpha:1 (ignored), R:5, G:5, B:5    */
  302.     kQ3PixelTypeARGB16            = 3,                            /* Alpha:1, R:5, G:5, B:5             */
  303.     kQ3PixelTypeRGB16_565        = 4,                            /* Win32 only: 16 bits/pixel, R:5, G:6, B:5        */
  304.     kQ3PixelTypeRGB24            = 5                                /* Win32 only: 24 bits/pixel, R:8, G:8, B:8        */
  305. };
  306. typedef enum TQ3PixelType TQ3PixelType;
  307.  
  308.  
  309. enum TQ3Endian {
  310.     kQ3EndianBig                = 0,
  311.     kQ3EndianLittle                = 1
  312. };
  313. typedef enum TQ3Endian TQ3Endian;
  314.  
  315.  
  316. enum TQ3EndCapMasks {
  317.     kQ3EndCapNone                = 0,
  318.     kQ3EndCapMaskTop            = 1 << 0,
  319.     kQ3EndCapMaskBottom            = 1 << 1,
  320.     kQ3EndCapMaskInterior        = 1 << 2
  321. };
  322. typedef enum TQ3EndCapMasks TQ3EndCapMasks;
  323.  
  324. typedef unsigned long                     TQ3EndCap;
  325.  
  326.     enum {
  327.         kQ3ArrayIndexNULL = ~0    
  328.     };
  329.     
  330.     
  331. /******************************************************************************
  332.  **                                                                             **
  333.  **                        Point and Vector Definitions                         **
  334.  **                                                                             **
  335.  *****************************************************************************/
  336.  
  337. struct TQ3Vector2D {
  338.     float                             x;
  339.     float                             y;
  340. };
  341. typedef struct TQ3Vector2D                TQ3Vector2D;
  342.  
  343. struct TQ3Vector3D {
  344.     float                             x;
  345.     float                             y;
  346.     float                             z;
  347. };
  348. typedef struct TQ3Vector3D                TQ3Vector3D;
  349.  
  350. struct TQ3Point2D {
  351.     float                             x;
  352.     float                             y;
  353. };
  354. typedef struct TQ3Point2D                TQ3Point2D;
  355.  
  356. struct TQ3Point3D {
  357.     float                             x;
  358.     float                             y;
  359.     float                             z;
  360. };
  361. typedef struct TQ3Point3D                TQ3Point3D;
  362.  
  363. struct TQ3RationalPoint4D {
  364.     float                             x;
  365.     float                             y;
  366.     float                             z;
  367.     float                             w;
  368. };
  369. typedef struct TQ3RationalPoint4D        TQ3RationalPoint4D;
  370.  
  371. struct TQ3RationalPoint3D {
  372.     float                             x;
  373.     float                             y;
  374.     float                             w;
  375. };
  376. typedef struct TQ3RationalPoint3D        TQ3RationalPoint3D;
  377. /******************************************************************************
  378.  **                                                                             **
  379.  **                                Quaternion                                     **
  380.  **                                                                             **
  381.  *****************************************************************************/
  382.  
  383. struct TQ3Quaternion {
  384.     float                             w;
  385.     float                             x;
  386.     float                             y;
  387.     float                             z;
  388. };
  389. typedef struct TQ3Quaternion            TQ3Quaternion;
  390. /******************************************************************************
  391.  **                                                                             **
  392.  **                                Ray Definition                                 **
  393.  **                                                                             **
  394.  *****************************************************************************/
  395.  
  396. struct TQ3Ray3D {
  397.     TQ3Point3D                         origin;
  398.     TQ3Vector3D                     direction;
  399. };
  400. typedef struct TQ3Ray3D                    TQ3Ray3D;
  401. /******************************************************************************
  402.  **                                                                             **
  403.  **                        Parameterization Data Structures                     **
  404.  **                                                                             **
  405.  *****************************************************************************/
  406.  
  407. struct TQ3Param2D {
  408.     float                             u;
  409.     float                             v;
  410. };
  411. typedef struct TQ3Param2D                TQ3Param2D;
  412.  
  413. struct TQ3Param3D {
  414.     float                             u;
  415.     float                             v;
  416.     float                             w;
  417. };
  418. typedef struct TQ3Param3D                TQ3Param3D;
  419.  
  420. struct TQ3Tangent2D {
  421.     TQ3Vector3D                     uTangent;
  422.     TQ3Vector3D                     vTangent;
  423. };
  424. typedef struct TQ3Tangent2D                TQ3Tangent2D;
  425.  
  426. struct TQ3Tangent3D {
  427.     TQ3Vector3D                     uTangent;
  428.     TQ3Vector3D                     vTangent;
  429.     TQ3Vector3D                     wTangent;
  430. };
  431. typedef struct TQ3Tangent3D                TQ3Tangent3D;
  432. /******************************************************************************
  433.  **                                                                             **
  434.  **                        Polar and Spherical Coordinates                         **
  435.  **                                                                             **
  436.  *****************************************************************************/
  437.  
  438. struct TQ3PolarPoint {
  439.     float                             r;
  440.     float                             theta;
  441. };
  442. typedef struct TQ3PolarPoint            TQ3PolarPoint;
  443.  
  444. struct TQ3SphericalPoint {
  445.     float                             rho;
  446.     float                             theta;
  447.     float                             phi;
  448. };
  449. typedef struct TQ3SphericalPoint        TQ3SphericalPoint;
  450. /******************************************************************************
  451.  **                                                                             **
  452.  **                            Color Definition                                 **
  453.  **                                                                             **
  454.  *****************************************************************************/
  455.  
  456. struct TQ3ColorRGB {
  457.     float                             r;
  458.     float                             g;
  459.     float                             b;
  460. };
  461. typedef struct TQ3ColorRGB                TQ3ColorRGB;
  462.  
  463. struct TQ3ColorARGB {
  464.     float                             a;
  465.     float                             r;
  466.     float                             g;
  467.     float                             b;
  468. };
  469. typedef struct TQ3ColorARGB                TQ3ColorARGB;
  470. /******************************************************************************
  471.  **                                                                             **
  472.  **                                    Vertices                                 **
  473.  **                                                                             **
  474.  *****************************************************************************/
  475.  
  476. struct TQ3Vertex3D {
  477.     TQ3Point3D                         point;
  478.     TQ3AttributeSet                 attributeSet;
  479. };
  480. typedef struct TQ3Vertex3D                TQ3Vertex3D;
  481. /******************************************************************************
  482.  **                                                                             **
  483.  **                                    Matrices                                 **
  484.  **                                                                             **
  485.  *****************************************************************************/
  486.  
  487. struct TQ3Matrix3x3 {
  488.     float                             value[3][3];
  489. };
  490. typedef struct TQ3Matrix3x3                TQ3Matrix3x3;
  491.  
  492. struct TQ3Matrix4x4 {
  493.     float                             value[4][4];
  494. };
  495. typedef struct TQ3Matrix4x4                TQ3Matrix4x4;
  496. /******************************************************************************
  497.  **                                                                             **
  498.  **                                Bitmap/Pixmap                                 **
  499.  **                                                                             **
  500.  *****************************************************************************/
  501.  
  502. struct TQ3Pixmap {
  503.     void *                            image;
  504.     unsigned long                     width;
  505.     unsigned long                     height;
  506.     unsigned long                     rowBytes;
  507.     unsigned long                     pixelSize;                    /* MUST be 16 or 32 to use with the    Interactive Renderer on Mac OS*/
  508.     TQ3PixelType                     pixelType;
  509.     TQ3Endian                         bitOrder;
  510.     TQ3Endian                         byteOrder;
  511. };
  512. typedef struct TQ3Pixmap                TQ3Pixmap;
  513.  
  514. struct TQ3StoragePixmap {
  515.     TQ3StorageObject                 image;
  516.     unsigned long                     width;
  517.     unsigned long                     height;
  518.     unsigned long                     rowBytes;
  519.     unsigned long                     pixelSize;                    /* MUST be 16 or 32 to use with the    Interactive Renderer on Mac OS*/
  520.     TQ3PixelType                     pixelType;
  521.     TQ3Endian                         bitOrder;
  522.     TQ3Endian                         byteOrder;
  523. };
  524. typedef struct TQ3StoragePixmap            TQ3StoragePixmap;
  525.  
  526. struct TQ3Bitmap {
  527.     unsigned char *                    image;
  528.     unsigned long                     width;
  529.     unsigned long                     height;
  530.     unsigned long                     rowBytes;
  531.     TQ3Endian                         bitOrder;
  532. };
  533. typedef struct TQ3Bitmap                TQ3Bitmap;
  534.  
  535. struct TQ3MipmapImage {                                            /* An image for use as a texture mipmap  */
  536.     unsigned long                     width;                        /* Width of mipmap, must be power of 2   */
  537.     unsigned long                     height;                        /* Height of mipmap, must be power of 2  */
  538.     unsigned long                     rowBytes;                    /* Rowbytes of mipmap                    */
  539.     unsigned long                     offset;                        /* Offset from image base to this mipmap */
  540. };
  541. typedef struct TQ3MipmapImage            TQ3MipmapImage;
  542.  
  543. struct TQ3Mipmap {
  544.     TQ3StorageObject                 image;                        /* Data containing the texture map and      */
  545.                                                                 /* if (useMipmapping==kQ3True) the          */
  546.                                                                 /* mipmap data                              */
  547.     TQ3Boolean                         useMipmapping;                /* True if mipmapping should be used      */
  548.                                                                 /* and all mipmaps have been provided    */
  549.     TQ3PixelType                     pixelType;
  550.     TQ3Endian                         bitOrder;
  551.     TQ3Endian                         byteOrder;
  552.     unsigned long                     reserved;                    /* leave NULL for next version             */
  553.     TQ3MipmapImage                     mipmaps[32];                /* The actual number of mipmaps is determined from the size of the first mipmap */
  554. };
  555. typedef struct TQ3Mipmap                TQ3Mipmap;
  556.  
  557.  
  558.  
  559. struct TQ3CompressedPixmap {
  560.     TQ3StorageObject                 compressedImage;            /* storage obj containing compressed image data */
  561.  
  562.     TQ3Endian                         imageDescByteOrder;            /* endianness of the data in the imageDesc */
  563.     TQ3StorageObject                 imageDesc;                    /* storage obj containing image description created by Quicktime to store info about compressed image */
  564.  
  565.     TQ3Boolean                         makeMipmaps;
  566.  
  567.     unsigned long                     width;
  568.     unsigned long                     height;
  569.     unsigned long                     pixelSize;
  570.     TQ3PixelType                     pixelType;
  571. };
  572. typedef struct TQ3CompressedPixmap        TQ3CompressedPixmap;
  573.  
  574. /******************************************************************************
  575.  **                                                                             **
  576.  **                        Higher dimension quantities                             **
  577.  **                                                                             **
  578.  *****************************************************************************/
  579.  
  580. struct TQ3Area {
  581.     TQ3Point2D                         min;
  582.     TQ3Point2D                         max;
  583. };
  584. typedef struct TQ3Area                    TQ3Area;
  585.  
  586. struct TQ3PlaneEquation {
  587.     TQ3Vector3D                     normal;
  588.     float                             constant;
  589. };
  590. typedef struct TQ3PlaneEquation            TQ3PlaneEquation;
  591.  
  592. struct TQ3BoundingBox {
  593.     TQ3Point3D                         min;
  594.     TQ3Point3D                         max;
  595.     TQ3Boolean                         isEmpty;
  596. };
  597. typedef struct TQ3BoundingBox            TQ3BoundingBox;
  598.  
  599. struct TQ3BoundingSphere {
  600.     TQ3Point3D                         origin;
  601.     float                             radius;
  602.     TQ3Boolean                         isEmpty;
  603. };
  604. typedef struct TQ3BoundingSphere        TQ3BoundingSphere;
  605. /*
  606.  *    The TQ3ComputeBounds flag passed to StartBoundingBox or StartBoundingSphere
  607.  *    calls in the View. It's a hint to the system as to how it should 
  608.  *    compute the bbox of a shape:
  609.  *
  610.  *    kQ3ComputeBoundsExact:    
  611.  *        Vertices of shapes are transformed into world space and
  612.  *        the world space bounding box is computed from them.  Slow!
  613.  *    
  614.  *    kQ3ComputeBoundsApproximate: 
  615.  *        A local space bounding box is computed from a shape's
  616.  *        vertices.  This bbox is then transformed into world space,
  617.  *        and its bounding box is taken as the shape's approximate
  618.  *        bbox.  Fast but the bbox is larger than optimal.
  619.  */
  620.  
  621. enum TQ3ComputeBounds {
  622.     kQ3ComputeBoundsExact        = 0,
  623.     kQ3ComputeBoundsApproximate    = 1
  624. };
  625. typedef enum TQ3ComputeBounds TQ3ComputeBounds;
  626.  
  627.  
  628. /******************************************************************************
  629.  **                                                                             **
  630.  **                            Object System Types                                 **
  631.  **                                                                             **
  632.  *****************************************************************************/
  633.  
  634. typedef struct OpaqueTQ3XObjectClass*     TQ3XObjectClass;
  635.  
  636. typedef unsigned long                     TQ3XMethodType;
  637. /*
  638.  * Object methods
  639.  */
  640. #define kQ3XMethodTypeObjectUnregister        Q3_METHOD_TYPE('u','n','r','g')
  641. /* 
  642.  *  Return true from the metahandler if this 
  643.  *  object can be submitted in a rendering loop 
  644.  */
  645. #define kQ3XMethodTypeObjectIsDrawable        Q3_METHOD_TYPE('i','s','d','r')    /* return true from the metahandler if this object can be submitted in a rendering loop */
  646. typedef CALLBACK_API_C( void , TQ3XFunctionPointer )(void );
  647. typedef CALLBACK_API_C( TQ3XFunctionPointer , TQ3XMetaHandler )(TQ3XMethodType methodType);
  648. /*
  649.  * MetaHandler:
  650.  *        When you give a metahandler to QuickDraw 3D, it is called multiple 
  651.  *        times to build method tables, and then is thrown away. You are 
  652.  *        guaranteed that your metahandler will never be called again after a 
  653.  *        call that was passed a metahandler returns.
  654.  *
  655.  *        Your metahandler should contain a switch on the methodType passed to it
  656.  *        and should return the corresponding method as an TQ3XFunctionPointer.
  657.  *
  658.  *        IMPORTANT: A metaHandler MUST always "return" a value. If you are
  659.  *        passed a methodType that you do not understand, ALWAYS return NULL.
  660.  *
  661.  *        These types here are prototypes of how your functions should look.
  662.  */
  663. typedef CALLBACK_API_C( TQ3Status , TQ3XObjectUnregisterMethod )(TQ3XObjectClass objectClass);
  664. /*
  665.  * See QD3DIO.h for the IO method types: 
  666.  *        ObjectReadData, ObjectTraverse, ObjectWrite
  667.  */
  668.  
  669. /******************************************************************************
  670.  **                                                                             **
  671.  **                                Set Types                                     **
  672.  **                                                                             **
  673.  *****************************************************************************/
  674. typedef long                             TQ3ElementType;
  675. enum {
  676.     kQ3ElementTypeNone            = 0,
  677.     kQ3ElementTypeUnknown        = 32,
  678.     kQ3ElementTypeSet            = 33
  679. };
  680.  
  681.  
  682. /* 
  683.  *    kQ3ElementTypeUnknown is a TQ3Object. 
  684.  *    
  685.  *        Do Q3Set_Add(s, ..., &obj) or Q3Set_Get(s, ..., &obj);
  686.  *        
  687.  *        Note that the object is always referenced when copying around. 
  688.  *        
  689.  *        Generally, it is an Unknown object, a Group of Unknown objects, or a 
  690.  *        group of other "objects" which have been found in the metafile and
  691.  *        have no attachment method to their parent. Be prepared to handle
  692.  *        any or all of these cases if you actually access the set on a shape.
  693.  *
  694.  *    kQ3ElementTypeSet is a TQ3SetObject. 
  695.  *    
  696.  *        Q3Shape_GetSet(s,&o) is eqivalent to 
  697.  *            Q3Shape_GetElement(s, kQ3ElementTypeSet, &o)
  698.  *            
  699.  *        Q3Shape_SetSet(s,o)  is eqivalent to 
  700.  *            Q3Shape_SetElement(s, kQ3ElementTypeSet, &o)
  701.  *    
  702.  *        Note that the object is always referenced when copying around. 
  703.  *        
  704.  *    See the note below about the Set and Shape changes.
  705.  */
  706.  
  707. /******************************************************************************
  708.  **                                                                             **
  709.  **                            Object System Macros                             **
  710.  **                                                                             **
  711.  *****************************************************************************/
  712.  
  713. #define Q3_FOUR_CHARACTER_CONSTANT(a,b,c,d)         \
  714.             ((const unsigned long)                     \
  715.             ((const unsigned long) (a) << 24) |     \
  716.             ((const unsigned long) (b) << 16) |        \
  717.             ((const unsigned long) (c) << 8)  |     \
  718.             ((const unsigned long) (d)))
  719.  
  720. #define Q3_OBJECT_TYPE(a,b,c,d) \
  721.     ((TQ3ObjectType) Q3_FOUR_CHARACTER_CONSTANT(a,b,c,d))
  722.  
  723. #define Q3_METHOD_TYPE(a,b,c,d) \
  724.     ((TQ3XMethodType) Q3_FOUR_CHARACTER_CONSTANT(a,b,c,d))
  725.  
  726. /******************************************************************************
  727.  **                                                                             **
  728.  **                                Object Types                                 **
  729.  **                                                                             **
  730.  *****************************************************************************/
  731. /*
  732.  * Note:    a call to Q3Foo_GetType will return a value kQ3FooTypeBar
  733.  *            e.g. Q3Shared_GetType(object) returns kQ3SharedTypeShape, etc.
  734.  */
  735.  
  736. #define kQ3ObjectTypeInvalid                            0L
  737. #define kQ3ObjectTypeView                                ((TQ3ObjectType)FOUR_CHAR_CODE('view'))
  738. #define kQ3ObjectTypeElement                            ((TQ3ObjectType)FOUR_CHAR_CODE('elmn'))
  739.     #define kQ3ElementTypeAttribute                        ((TQ3ObjectType)FOUR_CHAR_CODE('eatt'))
  740. #define kQ3ObjectTypePick                                ((TQ3ObjectType)FOUR_CHAR_CODE('pick'))
  741.     #define kQ3PickTypeWindowPoint                        ((TQ3ObjectType)FOUR_CHAR_CODE('pkwp'))
  742.     #define kQ3PickTypeWindowRect                        ((TQ3ObjectType)FOUR_CHAR_CODE('pkwr'))
  743.     #define kQ3PickTypeWorldRay                            ((TQ3ObjectType)FOUR_CHAR_CODE('pkry'))
  744. #define kQ3ObjectTypeShared                                ((TQ3ObjectType)FOUR_CHAR_CODE('shrd'))
  745.     #define kQ3SharedTypeRenderer                        ((TQ3ObjectType)FOUR_CHAR_CODE('rddr'))
  746.         #define kQ3RendererTypeWireFrame                ((TQ3ObjectType)FOUR_CHAR_CODE('wrfr'))
  747.         #define kQ3RendererTypeGeneric                    ((TQ3ObjectType)FOUR_CHAR_CODE('gnrr'))
  748.         #define kQ3RendererTypeInteractive                ((TQ3ObjectType)FOUR_CHAR_CODE('ctwn'))
  749.     #define kQ3SharedTypeShape                            ((TQ3ObjectType)FOUR_CHAR_CODE('shap'))
  750.  
  751.             
  752.         #define kQ3ShapeTypeGeometry                    ((TQ3ObjectType)FOUR_CHAR_CODE('gmtr'))
  753.             #define kQ3GeometryTypeBox                    ((TQ3ObjectType)FOUR_CHAR_CODE('box '))
  754.             #define kQ3GeometryTypeGeneralPolygon        ((TQ3ObjectType)FOUR_CHAR_CODE('gpgn'))
  755.             #define kQ3GeometryTypeLine                    ((TQ3ObjectType)FOUR_CHAR_CODE('line'))
  756.             #define kQ3GeometryTypeMarker                ((TQ3ObjectType)FOUR_CHAR_CODE('mrkr'))
  757.             #define kQ3GeometryTypePixmapMarker            ((TQ3ObjectType)FOUR_CHAR_CODE('mrkp'))
  758.             #define kQ3GeometryTypeMesh                    ((TQ3ObjectType)FOUR_CHAR_CODE('mesh'))
  759.             #define kQ3GeometryTypeNURBCurve            ((TQ3ObjectType)FOUR_CHAR_CODE('nrbc'))
  760.             #define kQ3GeometryTypeNURBPatch            ((TQ3ObjectType)FOUR_CHAR_CODE('nrbp'))
  761.             #define kQ3GeometryTypePoint                ((TQ3ObjectType)FOUR_CHAR_CODE('pnt '))
  762.             #define kQ3GeometryTypePolygon                ((TQ3ObjectType)FOUR_CHAR_CODE('plyg'))
  763.             #define kQ3GeometryTypePolyLine                ((TQ3ObjectType)FOUR_CHAR_CODE('plyl'))
  764.             #define kQ3GeometryTypeTriangle                ((TQ3ObjectType)FOUR_CHAR_CODE('trng'))
  765.             #define kQ3GeometryTypeTriGrid                ((TQ3ObjectType)FOUR_CHAR_CODE('trig'))
  766.             #define kQ3GeometryTypeCone                    ((TQ3ObjectType)FOUR_CHAR_CODE('cone'))
  767.             #define kQ3GeometryTypeCylinder                ((TQ3ObjectType)FOUR_CHAR_CODE('cyln'))
  768.             #define kQ3GeometryTypeDisk                    ((TQ3ObjectType)FOUR_CHAR_CODE('disk'))
  769.             #define kQ3GeometryTypeEllipse                ((TQ3ObjectType)FOUR_CHAR_CODE('elps'))
  770.             #define kQ3GeometryTypeEllipsoid            ((TQ3ObjectType)FOUR_CHAR_CODE('elpd'))
  771.             #define kQ3GeometryTypePolyhedron            ((TQ3ObjectType)FOUR_CHAR_CODE('plhd'))
  772.             #define kQ3GeometryTypeTorus                ((TQ3ObjectType)FOUR_CHAR_CODE('tors'))
  773.             #define kQ3GeometryTypeTriMesh                ((TQ3ObjectType)FOUR_CHAR_CODE('tmsh'))
  774.  
  775.             
  776.         #define kQ3ShapeTypeShader                        ((TQ3ObjectType)FOUR_CHAR_CODE('shdr'))
  777.             #define kQ3ShaderTypeSurface                ((TQ3ObjectType)FOUR_CHAR_CODE('sush'))
  778.                 #define kQ3SurfaceShaderTypeTexture        ((TQ3ObjectType)FOUR_CHAR_CODE('txsu'))
  779.             #define kQ3ShaderTypeIllumination            ((TQ3ObjectType)FOUR_CHAR_CODE('ilsh'))
  780.                 #define kQ3IlluminationTypePhong        ((TQ3ObjectType)FOUR_CHAR_CODE('phil'))
  781.                 #define kQ3IlluminationTypeLambert        ((TQ3ObjectType)FOUR_CHAR_CODE('lmil'))
  782.                 #define kQ3IlluminationTypeNULL            ((TQ3ObjectType)FOUR_CHAR_CODE('nuil'))
  783.         #define kQ3ShapeTypeStyle                        ((TQ3ObjectType)FOUR_CHAR_CODE('styl'))
  784.             #define kQ3StyleTypeBackfacing                ((TQ3ObjectType)FOUR_CHAR_CODE('bckf'))
  785.             #define kQ3StyleTypeInterpolation            ((TQ3ObjectType)FOUR_CHAR_CODE('intp'))
  786.             #define kQ3StyleTypeFill                    ((TQ3ObjectType)FOUR_CHAR_CODE('fist'))
  787.             #define kQ3StyleTypePickID                    ((TQ3ObjectType)FOUR_CHAR_CODE('pkid'))
  788.             #define kQ3StyleTypeReceiveShadows            ((TQ3ObjectType)FOUR_CHAR_CODE('rcsh'))
  789.             #define kQ3StyleTypeHighlight                ((TQ3ObjectType)FOUR_CHAR_CODE('high'))
  790.             #define kQ3StyleTypeSubdivision                ((TQ3ObjectType)FOUR_CHAR_CODE('sbdv'))
  791.             #define kQ3StyleTypeOrientation                ((TQ3ObjectType)FOUR_CHAR_CODE('ofdr'))
  792.             #define kQ3StyleTypePickParts                ((TQ3ObjectType)FOUR_CHAR_CODE('pkpt'))
  793.             #define kQ3StyleTypeAntiAlias                ((TQ3ObjectType)FOUR_CHAR_CODE('anti'))
  794.             #define kQ3StyleTypeFog                        ((TQ3ObjectType)FOUR_CHAR_CODE('fogg'))
  795.  
  796.             
  797.         #define kQ3ShapeTypeTransform                    ((TQ3ObjectType)FOUR_CHAR_CODE('xfrm'))
  798.             #define kQ3TransformTypeMatrix                ((TQ3ObjectType)FOUR_CHAR_CODE('mtrx'))
  799.             #define kQ3TransformTypeScale                ((TQ3ObjectType)FOUR_CHAR_CODE('scal'))
  800.             #define kQ3TransformTypeTranslate            ((TQ3ObjectType)FOUR_CHAR_CODE('trns'))
  801.             #define kQ3TransformTypeRotate                ((TQ3ObjectType)FOUR_CHAR_CODE('rott'))
  802.             #define kQ3TransformTypeRotateAboutPoint     ((TQ3ObjectType)FOUR_CHAR_CODE('rtap'))
  803.             #define kQ3TransformTypeRotateAboutAxis     ((TQ3ObjectType)FOUR_CHAR_CODE('rtaa'))
  804.             #define kQ3TransformTypeQuaternion            ((TQ3ObjectType)FOUR_CHAR_CODE('qtrn'))
  805.             #define kQ3TransformTypeReset                ((TQ3ObjectType)FOUR_CHAR_CODE('rset'))
  806.         #define kQ3ShapeTypeLight                        ((TQ3ObjectType)FOUR_CHAR_CODE('lght'))
  807.             #define kQ3LightTypeAmbient                    ((TQ3ObjectType)FOUR_CHAR_CODE('ambn'))
  808.             #define kQ3LightTypeDirectional                ((TQ3ObjectType)FOUR_CHAR_CODE('drct'))
  809.             #define kQ3LightTypePoint                    ((TQ3ObjectType)FOUR_CHAR_CODE('pntl'))
  810.             #define kQ3LightTypeSpot                    ((TQ3ObjectType)FOUR_CHAR_CODE('spot'))
  811.  
  812.             
  813.         #define kQ3ShapeTypeCamera                        ((TQ3ObjectType)FOUR_CHAR_CODE('cmra'))
  814.             #define kQ3CameraTypeOrthographic            ((TQ3ObjectType)FOUR_CHAR_CODE('orth'))
  815.             #define kQ3CameraTypeViewPlane                ((TQ3ObjectType)FOUR_CHAR_CODE('vwpl'))
  816.             #define kQ3CameraTypeViewAngleAspect        ((TQ3ObjectType)FOUR_CHAR_CODE('vana'))
  817.         #define kQ3ShapeTypeStateOperator                ((TQ3ObjectType)FOUR_CHAR_CODE('stop'))
  818.             #define kQ3StateOperatorTypePush            ((TQ3ObjectType)FOUR_CHAR_CODE('push'))
  819.             #define kQ3StateOperatorTypePop             ((TQ3ObjectType)FOUR_CHAR_CODE('pop '))
  820.         #define kQ3ShapeTypeGroup                        ((TQ3ObjectType)FOUR_CHAR_CODE('grup'))
  821.             #define kQ3GroupTypeDisplay                    ((TQ3ObjectType)FOUR_CHAR_CODE('dspg'))
  822.                 #define kQ3DisplayGroupTypeOrdered        ((TQ3ObjectType)FOUR_CHAR_CODE('ordg'))
  823.                 #define kQ3DisplayGroupTypeIOProxy        ((TQ3ObjectType)FOUR_CHAR_CODE('iopx'))
  824.             #define kQ3GroupTypeLight                    ((TQ3ObjectType)FOUR_CHAR_CODE('lghg'))
  825.             #define kQ3GroupTypeInfo                    ((TQ3ObjectType)FOUR_CHAR_CODE('info'))
  826.  
  827.             
  828.         #define kQ3ShapeTypeUnknown                        ((TQ3ObjectType)FOUR_CHAR_CODE('unkn'))
  829.             #define kQ3UnknownTypeText                    ((TQ3ObjectType)FOUR_CHAR_CODE('uktx'))
  830.             #define kQ3UnknownTypeBinary                ((TQ3ObjectType)FOUR_CHAR_CODE('ukbn'))
  831.         #define kQ3ShapeTypeReference                    ((TQ3ObjectType)FOUR_CHAR_CODE('rfrn'))
  832.             #define kQ3ReferenceTypeExternal            ((TQ3ObjectType)FOUR_CHAR_CODE('rfex'))
  833.     #define kQ3SharedTypeSet                            ((TQ3ObjectType)FOUR_CHAR_CODE('set '))
  834.         #define kQ3SetTypeAttribute                        ((TQ3ObjectType)FOUR_CHAR_CODE('attr'))
  835.     #define kQ3SharedTypeDrawContext                    ((TQ3ObjectType)FOUR_CHAR_CODE('dctx'))
  836.         #define kQ3DrawContextTypePixmap                ((TQ3ObjectType)FOUR_CHAR_CODE('dpxp'))
  837.         #define kQ3DrawContextTypeMacintosh                ((TQ3ObjectType)FOUR_CHAR_CODE('dmac'))
  838.         #define kQ3DrawContextTypeWin32DC                ((TQ3ObjectType)FOUR_CHAR_CODE('dw32'))
  839.         #define kQ3DrawContextTypeDDSurface                ((TQ3ObjectType)FOUR_CHAR_CODE('ddds'))
  840.         #define kQ3DrawContextTypeX11                    ((TQ3ObjectType)FOUR_CHAR_CODE('dx11'))
  841.     #define kQ3SharedTypeTexture                        ((TQ3ObjectType)FOUR_CHAR_CODE('txtr'))
  842.         #define kQ3TextureTypePixmap                    ((TQ3ObjectType)FOUR_CHAR_CODE('txpm'))    
  843.         #define kQ3TextureTypeMipmap                    ((TQ3ObjectType)FOUR_CHAR_CODE('txmm'))    
  844.         #define kQ3TextureTypeCompressedPixmap            ((TQ3ObjectType)FOUR_CHAR_CODE('txcp'))
  845.  
  846.             
  847.     #define kQ3SharedTypeFile                            ((TQ3ObjectType)FOUR_CHAR_CODE('file'))
  848.     #define kQ3SharedTypeStorage                        ((TQ3ObjectType)FOUR_CHAR_CODE('strg'))
  849.         #define kQ3StorageTypeMemory                    ((TQ3ObjectType)FOUR_CHAR_CODE('mems'))
  850.         #define kQ3MemoryStorageTypeHandle                ((TQ3ObjectType)FOUR_CHAR_CODE('hndl'))
  851.         #define kQ3StorageTypeUnix                        ((TQ3ObjectType)FOUR_CHAR_CODE('uxst'))
  852.         #define kQ3UnixStorageTypePath                    ((TQ3ObjectType)FOUR_CHAR_CODE('unix'))
  853.         #define kQ3StorageTypeMacintosh                    ((TQ3ObjectType)FOUR_CHAR_CODE('macn'))
  854.         #define kQ3MacintoshStorageTypeFSSpec            ((TQ3ObjectType)FOUR_CHAR_CODE('macp'))                    
  855.         #define kQ3StorageTypeWin32                        ((TQ3ObjectType)FOUR_CHAR_CODE('wist'))
  856.     #define kQ3SharedTypeString                            ((TQ3ObjectType)FOUR_CHAR_CODE('strn'))
  857.         #define kQ3StringTypeCString                    ((TQ3ObjectType)FOUR_CHAR_CODE('strc'))
  858.     #define kQ3SharedTypeShapePart                        ((TQ3ObjectType)FOUR_CHAR_CODE('sprt'))
  859.         #define kQ3ShapePartTypeMeshPart                ((TQ3ObjectType)FOUR_CHAR_CODE('spmh'))
  860.             #define kQ3MeshPartTypeMeshFacePart            ((TQ3ObjectType)FOUR_CHAR_CODE('mfac'))
  861.             #define kQ3MeshPartTypeMeshEdgePart            ((TQ3ObjectType)FOUR_CHAR_CODE('medg'))
  862.             #define kQ3MeshPartTypeMeshVertexPart        ((TQ3ObjectType)FOUR_CHAR_CODE('mvtx'))
  863.     #define kQ3SharedTypeControllerState                ((TQ3ObjectType)FOUR_CHAR_CODE('ctst'))
  864.     #define kQ3SharedTypeTracker                        ((TQ3ObjectType)FOUR_CHAR_CODE('trkr'))
  865.     #define kQ3SharedTypeViewHints                        ((TQ3ObjectType)FOUR_CHAR_CODE('vwhn'))
  866.     #define kQ3SharedTypeEndGroup                        ((TQ3ObjectType)FOUR_CHAR_CODE('endg'))
  867.  
  868. /******************************************************************************
  869.  **                                                                             **
  870.  **                            QuickDraw 3D System Routines                     **
  871.  **                                                                             **
  872.  *****************************************************************************/
  873. EXTERN_API_C( TQ3Status )
  874. Q3Initialize                    (void);
  875.  
  876. EXTERN_API_C( TQ3Status )
  877. Q3Exit                            (void);
  878.  
  879. EXTERN_API_C( TQ3Boolean )
  880. Q3IsInitialized                    (void);
  881.  
  882. EXTERN_API_C( TQ3Status )
  883. Q3GetVersion                    (unsigned long *        majorRevision,
  884.                                  unsigned long *        minorRevision);
  885.  
  886. /*
  887.  *  Q3GetReleaseVersion returns the release version number,
  888.  *  in the format of the first four bytes of a 'vers' resource
  889.  *  (e.g. 0x01518000 ==> 1.5.1 release).
  890.  */
  891. EXTERN_API_C( TQ3Status )
  892. Q3GetReleaseVersion                (unsigned long *        releaseRevision);
  893.  
  894.  
  895. /******************************************************************************
  896.  **                                                                             **
  897.  **                            ObjectClass Routines                             **
  898.  **                                                                             **
  899.  *****************************************************************************/
  900. /* 
  901.  *  New object system calls to query the object system.
  902.  *
  903.  *  These comments to move to the stubs file before final release, they 
  904.  *  are here for documentation for developers using early seeds.
  905.  */
  906. /*
  907.  *  Given a class name as a string return the associated class type for the 
  908.  *  class, may return kQ3Failure if the string representing the class is 
  909.  *  invalid.
  910.  */
  911. EXTERN_API_C( TQ3Status )
  912. Q3ObjectHierarchy_GetTypeFromString (TQ3ObjectClassNameString  objectClassString,
  913.                                  TQ3ObjectType *        objectClassType);
  914.  
  915. /*
  916.  *  Given a class type as return the associated string for the class name, 
  917.  *  may return kQ3Failure if the type representing the class is invalid.
  918.  */
  919. EXTERN_API_C( TQ3Status )
  920. Q3ObjectHierarchy_GetStringFromType (TQ3ObjectType         objectClassType,
  921.                                  TQ3ObjectClassNameString  objectClassString);
  922.  
  923. /* 
  924.  *  Return true if the class with this type is registered, false if not 
  925.  */
  926. EXTERN_API_C( TQ3Boolean )
  927. Q3ObjectHierarchy_IsTypeRegistered (TQ3ObjectType         objectClassType);
  928.  
  929. /* 
  930.  *  Return true if the class with this name is registered, false if not 
  931.  */
  932. EXTERN_API_C( TQ3Boolean )
  933. Q3ObjectHierarchy_IsNameRegistered (const char *        objectClassName);
  934.  
  935. /*
  936.  * TQ3SubClassData is used when querying the object system for
  937.  * the subclasses of a particular parent type:
  938.  */
  939.  
  940. struct TQ3SubClassData {
  941.     unsigned long                     numClasses;                    /* the # of subclass types found for a parent class */
  942.     TQ3ObjectType *                    classTypes;                    /* an array containing the class types */
  943. };
  944. typedef struct TQ3SubClassData            TQ3SubClassData;
  945. /*
  946.  *  Given a parent type and an instance of the TQ3SubClassData struct fill
  947.  *  it in with the number and class types of all of the subclasses immediately
  948.  *  below the parent in the class hierarchy.  Return kQ3Success to indicate no
  949.  *  errors occurred, else kQ3Failure.
  950.  *
  951.  *  NOTE:  This function will allocate memory for the classTypes array.  Be 
  952.  *    sure to call Q3ObjectClass_EmptySubClassData to free this memory up.
  953.  */
  954. EXTERN_API_C( TQ3Status )
  955. Q3ObjectHierarchy_GetSubClassData (TQ3ObjectType         objectClassType,
  956.                                  TQ3SubClassData *        subClassData);
  957.  
  958. /*
  959.  *  Given an instance of the TQ3SubClassData struct free all memory allocated 
  960.  *    by the Q3ObjectClass_GetSubClassData call.
  961.  *
  962.  *  NOTE: This call MUST be made after a call to Q3ObjectClass_GetSubClassData
  963.  *  to avoid memory leaks.
  964.  */
  965. EXTERN_API_C( TQ3Status )
  966. Q3ObjectHierarchy_EmptySubClassData (TQ3SubClassData *    subClassData);
  967.  
  968.  
  969. /******************************************************************************
  970.  **                                                                             **
  971.  **                                Object Routines                                 **
  972.  **                                                                             **
  973.  *****************************************************************************/
  974. EXTERN_API_C( TQ3Status )
  975. Q3Object_Dispose                (TQ3Object                 object);
  976.  
  977. EXTERN_API_C( TQ3Object )
  978. Q3Object_Duplicate                (TQ3Object                 object);
  979.  
  980. EXTERN_API_C( TQ3Status )
  981. Q3Object_Submit                    (TQ3Object                 object,
  982.                                  TQ3ViewObject             view);
  983.  
  984. EXTERN_API_C( TQ3Boolean )
  985. Q3Object_IsDrawable                (TQ3Object                 object);
  986.  
  987. EXTERN_API_C( TQ3Boolean )
  988. Q3Object_IsWritable                (TQ3Object                 object,
  989.                                  TQ3FileObject             theFile);
  990.  
  991.  
  992. /******************************************************************************
  993.  **                                                                             **
  994.  **                            Object Type Routines                             **
  995.  **                                                                             **
  996.  *****************************************************************************/
  997. EXTERN_API_C( TQ3ObjectType )
  998. Q3Object_GetType                (TQ3Object                 object);
  999.  
  1000. EXTERN_API_C( TQ3ObjectType )
  1001. Q3Object_GetLeafType            (TQ3Object                 object);
  1002.  
  1003. EXTERN_API_C( TQ3Boolean )
  1004. Q3Object_IsType                    (TQ3Object                 object,
  1005.                                  TQ3ObjectType             theType);
  1006.  
  1007.  
  1008. /******************************************************************************
  1009.  **                                                                             **
  1010.  **                            Shared Object Routines                             **
  1011.  **                                                                             **
  1012.  *****************************************************************************/
  1013. EXTERN_API_C( TQ3ObjectType )
  1014. Q3Shared_GetType                (TQ3SharedObject         sharedObject);
  1015.  
  1016. EXTERN_API_C( TQ3SharedObject )
  1017. Q3Shared_GetReference            (TQ3SharedObject         sharedObject);
  1018.  
  1019. /* 
  1020.  *    Q3Shared_IsReferenced
  1021.  *        Returns kQ3True if there is more than one reference to sharedObject.
  1022.  *        Returns kQ3False if there is ONE reference to sharedObject.
  1023.  *    
  1024.  *    This call is intended to allow applications and plug-in objects to delete
  1025.  *    objects of which they hold THE ONLY REFERENCE. This is useful when
  1026.  *    caching objects, etc.
  1027.  *    
  1028.  *    Although many may be tempted, DO NOT DO THIS:
  1029.  *        while (Q3Shared_IsReferenced(foo)) { Q3Object_Dispose(foo); }
  1030.  *    
  1031.  *    Your application will crash and no one will buy it. Chapter 11 is 
  1032.  *    never fun (unless you short the stock). Thanks.
  1033.  */
  1034. EXTERN_API_C( TQ3Boolean )
  1035. Q3Shared_IsReferenced            (TQ3SharedObject         sharedObject);
  1036.  
  1037. /*
  1038.  *    Q3Shared_GetEditIndex
  1039.  *        Returns the "serial number" of sharedObject. Usefuly for caching 
  1040.  *        object information. Returns 0 on error.
  1041.  *        
  1042.  *        Hold onto this number to determine if an object has changed since you
  1043.  *        last built your caches... To validate, do:
  1044.  *        
  1045.  *        if (Q3Shared_GetEditIndex(foo) == oldFooEditIndex) {
  1046.  *            // Cache is valid
  1047.  *        } else {
  1048.  *            // Cache is invalid
  1049.  *            RebuildSomeSortOfCache(foo);
  1050.  *            oldFooEditIndex = Q3Shared_GetEditIndex(foo);
  1051.  *        }
  1052.  */
  1053. EXTERN_API_C( unsigned long )
  1054. Q3Shared_GetEditIndex            (TQ3SharedObject         sharedObject);
  1055.  
  1056. /*
  1057.  *    Q3Shared_Edited
  1058.  *        Bumps the "serial number" of sharedObject to a different value. This
  1059.  *        call is intended to be used solely from a plug-in object which is 
  1060.  *        shared. Call this whenever your private instance data changes.
  1061.  *        
  1062.  *        Returns kQ3Failure iff sharedObject is not a shared object, OR
  1063.  *            QuickDraw 3D isn't initialized.
  1064.  */
  1065. EXTERN_API_C( TQ3Status )
  1066. Q3Shared_Edited                    (TQ3SharedObject         sharedObject);
  1067.  
  1068.  
  1069. /******************************************************************************
  1070.  **                                                                             **
  1071.  **                                Shape Routines                                 **
  1072.  **                                                                             **
  1073.  *****************************************************************************/
  1074. /*
  1075.  *    QuickDraw 3D 1.5 Note:
  1076.  *
  1077.  *    Shapes and Sets are now (sort of) polymorphic.
  1078.  *
  1079.  *        You may call Q3Shape_Foo or Q3Set_Foo on a shape or a set.
  1080.  *        The following calls are identical, in implementation:
  1081.  *
  1082.  *            Q3Shape_GetElement            =    Q3Set_Get
  1083.  *            Q3Shape_AddElement            =    Q3Set_Add
  1084.  *            Q3Shape_ContainsElement        =    Q3Set_Contains
  1085.  *            Q3Shape_GetNextElementType    =    Q3Set_GetNextElementType
  1086.  *            Q3Shape_EmptyElements        =    Q3Set_Empty
  1087.  *            Q3Shape_ClearElement        =    Q3Set_Clear
  1088.  *
  1089.  *    All of these calls accept a shape or a set as their first parameter.
  1090.  *
  1091.  *    The Q3Shape_GetSet and Q3ShapeSetSet calls are implemented via a new
  1092.  *    element type kQ3ElementTypeSet. See the note above about 
  1093.  *    kQ3ElementTypeSet;
  1094.  *
  1095.  *    It is important to note that the new Q3Shape_...Element... calls do not
  1096.  *    create a set on a shape and then add the element to it. This data is
  1097.  *    attached directly to the shape. Therefore, it is possible for an element
  1098.  *    to exist on a shape without a set existing on it as well. 
  1099.  *
  1100.  *    In your application, if you attach an element to a shape like this:
  1101.  *        (this isn't checking for errors for simplicity)
  1102.  *
  1103.  *        set = Q3Set_New();
  1104.  *        Q3Set_AddElement(set, kMyElemType, &data);
  1105.  *        Q3Shape_SetSet(shape, set);
  1106.  *
  1107.  *    You should retrieve it in the same manner:
  1108.  *
  1109.  *        Q3Shape_GetSet(shape, &set);
  1110.  *        if (Q3Set_Contains(set, kMyElemType) == kTrue) {
  1111.  *            Q3Set_Get(set, kMyElemType, &data);
  1112.  *        }
  1113.  *
  1114.  *    Similarly, if you attach data to a shape with the new calls:
  1115.  *
  1116.  *        Q3Shape_AddElement(shape, kMyElemType, &data);
  1117.  *
  1118.  *    You should retrieve it in the same manner:
  1119.  *
  1120.  *        if (Q3Shape_ContainsElement(set, kMyElemType) == kTrue) {
  1121.  *            Q3Shape_GetElement(set, kMyElemType, &data);
  1122.  *        }
  1123.  *
  1124.  *    This really becomes an issue when dealing with version 1.0 and version 1.1 
  1125.  *    metafiles.
  1126.  *
  1127.  *    When attempting to find a particular element on a shape, you should
  1128.  *    first check with Q3Shape_GetNextElementType or Q3Shape_GetElement, then,
  1129.  *    Q3Shape_GetSet(s, &set) (or Q3Shape_GetElement(s, kQ3ElementTypeSet, &set))
  1130.  *    and then Q3Shape_GetElement(set, ...).
  1131.  *
  1132.  *    In terms of implementation, Q3Shape_SetSet and Q3Shape_GetSet should only be
  1133.  *    used for sets of information that are shared among multiple shapes.
  1134.  *    
  1135.  *    Q3Shape_AddElement, Q3Shape_GetElement, etc. calls should only be used
  1136.  *    for elements that are unique for a particular shape.
  1137.  *    
  1138.  */
  1139. EXTERN_API_C( TQ3ObjectType )
  1140. Q3Shape_GetType                    (TQ3ShapeObject         shape);
  1141.  
  1142. EXTERN_API_C( TQ3Status )
  1143. Q3Shape_GetSet                    (TQ3ShapeObject         shape,
  1144.                                  TQ3SetObject *            theSet);
  1145.  
  1146. EXTERN_API_C( TQ3Status )
  1147. Q3Shape_SetSet                    (TQ3ShapeObject         shape,
  1148.                                  TQ3SetObject             theSet);
  1149.  
  1150. EXTERN_API_C( TQ3Status )
  1151. Q3Shape_AddElement                (TQ3ShapeObject         shape,
  1152.                                  TQ3ElementType         theType,
  1153.                                  const void *            data);
  1154.  
  1155. EXTERN_API_C( TQ3Status )
  1156. Q3Shape_GetElement                (TQ3ShapeObject         shape,
  1157.                                  TQ3ElementType         theType,
  1158.                                  void *                    data);
  1159.  
  1160. EXTERN_API_C( TQ3Boolean )
  1161. Q3Shape_ContainsElement            (TQ3ShapeObject         shape,
  1162.                                  TQ3ElementType         theType);
  1163.  
  1164. EXTERN_API_C( TQ3Status )
  1165. Q3Shape_GetNextElementType        (TQ3ShapeObject         shape,
  1166.                                  TQ3ElementType *        theType);
  1167.  
  1168. EXTERN_API_C( TQ3Status )
  1169. Q3Shape_EmptyElements            (TQ3ShapeObject         shape);
  1170.  
  1171. EXTERN_API_C( TQ3Status )
  1172. Q3Shape_ClearElement            (TQ3ShapeObject         shape,
  1173.                                  TQ3ElementType         theType);
  1174.  
  1175.  
  1176. /******************************************************************************
  1177.  **                                                                             **
  1178.  **                            Color Table Routines                             **
  1179.  **                                                                             **
  1180.  *****************************************************************************/
  1181. EXTERN_API_C( TQ3Status )
  1182. Q3Bitmap_Empty                    (TQ3Bitmap *            bitmap);
  1183.  
  1184. EXTERN_API_C( unsigned long )
  1185. Q3Bitmap_GetImageSize            (unsigned long             width,
  1186.                                  unsigned long             height);
  1187.  
  1188.  
  1189.  
  1190.  
  1191. #if PRAGMA_ENUM_ALWAYSINT
  1192.     #pragma enumsalwaysint reset
  1193. #elif PRAGMA_ENUM_OPTIONS
  1194.     #pragma option enum=reset
  1195. #elif defined(PRAGMA_ENUM_PACK__QD3D__)
  1196.     #pragma options(pack_enums)
  1197. #endif
  1198.  
  1199. #if PRAGMA_STRUCT_ALIGN
  1200.     #pragma options align=reset
  1201. #elif PRAGMA_STRUCT_PACKPUSH
  1202.     #pragma pack(pop)
  1203. #elif PRAGMA_STRUCT_PACK
  1204.     #pragma pack()
  1205. #endif
  1206.  
  1207. #ifdef PRAGMA_IMPORT_OFF
  1208. #pragma import off
  1209. #elif PRAGMA_IMPORT
  1210. #pragma import reset
  1211. #endif
  1212.  
  1213. #ifdef __cplusplus
  1214. }
  1215. #endif
  1216.  
  1217. #endif /* __QD3D__ */
  1218.  
  1219.